﻿using System;
using System.Windows.Input;

namespace WindowsPhoneMvp.Navigation
{
    /// <summary>
    /// Defines an interface for navigation
    /// </summary>
    public interface INavigationService
    {
        ///<summary>
        /// Generates a navigation command for the specified view
        ///</summary>
        ///<param name="parameterBuilder">Builds navigation parameters. x => x.With("Name", value)</param>
        ///<typeparam name="TView">The view to navigate to</typeparam>
        ///<returns>The delegate Navigation Command</returns>
        ICommand ByCommand<TView>(Action<NavigationData> parameterBuilder) where TView : IView;
        ///<summary>
        /// Generates a navigation command for the specified view
        ///</summary>
        ///<typeparam name="TView">The view to navigate to</typeparam>
        ///<returns>The delegate Navigation Command</returns>
        ICommand ByCommand<TView>() where TView : IView;
        ///<summary>
        /// Generates a navigation command to navigate Back to the previous view
        ///</summary>
        ///<returns>The delegate Navigation Command</returns>
        ICommand BackByCommand();
        ///<summary>
        /// Navigates to the specified view
        ///</summary>
        ///<typeparam name="TView">The view to navigate to</typeparam>
        void ToView<TView>() where TView : IView;
        ///<summary>
        /// Navigates to the specified view
        ///</summary>
        ///<typeparam name="TView">The view to navigate to</typeparam>
        void ToView<TView>(Action<NavigationData> parameterBuilder) where TView : IView;
        ///<summary>
        /// Navigates to the specified view
        ///</summary>
        void ToView(string viewName, Action<NavigationData> parameterBuilder);
        ///<summary>
        /// Navigates Back to the previous view
        ///</summary>
        void Back();
        /// <summary>
        /// Navigates back through the stack until the specified view is reached
        /// </summary>
        /// <typeparam name="TView"></typeparam>
        void BackToView<TView>() where TView : IView;
        /// <summary>
        /// Creates a navigation service that prevents items from being journaled
        /// </summary>
        /// <returns></returns>
        INavigationService WithoutBack();
        /// <summary>
        /// Removed the most recent item from the back stack
        /// </summary>
        void RemoveBackEntry();
        /// <summary>
        /// Removed the most recent item from the back stack of the specified view type
        /// </summary>
        void RemoveBackEntry<TView>() where TView : IView;
        ///<summary>
        /// Returns the path to the specified view
        ///</summary>
        ///<typeparam name="TView">The view to navigate to</typeparam>
        Uri UriFor<TView>() where TView : IView;
        ///<summary>
        /// Returns the path to the specified view
        ///</summary>
        ///<typeparam name="TView">The view to navigate to</typeparam>
        Uri UriFor<TView>(Action<NavigationData> parameterBuilder) where TView : IView;
    }
}
